<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage="" pageEncoding="utf-8"%>
<%@ page import="javax.servlet.http.HttpServlet"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="javax.servlet.http.HttpServletResponse"%>
<%@page import="iwpl.teky.sample.daos.CategoriesDAO"%>
<%@page import="iwpl.teky.sample.entities.Categories"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Untitled Document</title>
	</head>
	<body>
		<form name="FrmDUICate" action="./servlet/MyControl" method="get">
			<%
				String sCateName = "";
				int sCateStatus = 0;
				String sCateID = "";
				String sID = request.getParameter("id");
				
				CategoriesDAO dao = new CategoriesDAO();
				Categories cate = dao.findById(Integer.parseInt(sID));
				
				sCateID = cate.getCategoryId().toString();
				sCateName = cate.getCategoryName();
				if(cate.getStatus())
				{
					sCateStatus = 1;
				}
				else
				{
					sCateStatus = 0;
				}
			%>
			<table width="300" border="0">
				<tr>
					<td colspan="2">
						Cap Nhat Chu De
						<input type="hidden" name="hiddenid" value="<%=sCateID%>"/>
					</td>
				</tr>
				<tr>
					<td width="30%">
						Ten Chu De
					</td>
					<td width="70%">
						<input type="text" name="TxtCateName" width="204px"
							value="<%=sCateName%>" />
					</td>
				</tr>
				<tr>
					<td>
						Trang Thai
					</td>
					<td>
						<%
							if (sCateStatus == 1) {
								out.println("<input type=\"checkbox\" name=\"CboStatus\"");
								out.println("checked=\"checked\" />");
							} else {
								out.println("<input type=\"checkbox\" name=\"CboStatus\" />");
							}
						%>
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;

					</td>
					<td>
						<table width="100%" border="0">
							<tr>
								<td width="50%">
									<input type="submit" name="BtnUpdate" value="Cap Nhat" />
								</td>
								<td>
									<input type="submit" name="BtnExit" value="Thoat" />
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>

		</form>
	</body>
</html>